﻿using DevExpress.XtraEditors;
using DXApplicationTangche.UC.抖音出入库.Service;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DXApplicationTangche.UC.抖音出入库.抖音下单
{
    public partial class Form秒杀未发货 : DevExpress.XtraEditors.XtraForm
    {
        private List<RetailUserOrderVO> retailUserOrders = new List<RetailUserOrderVO>();
        public Form秒杀未发货()
        {
            InitializeComponent();
            this.refresh();
        }

        private void refresh()
        {
            List < RetailUserOrderDTO > retailUserOrderDTOs = 零售Service.getUnDeliveryUserOrder("SSHIRT","18");
            foreach (RetailUserOrderDTO item in retailUserOrderDTOs)
            {
                this.retailUserOrders.Add(new RetailUserOrderVO(item));
            }
            this.gridControl未发货.DataSource = this.retailUserOrders;
            this.gridView未发货.RefreshData();
        }

        private void 发货ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                String mobile = this.gridView未发货.GetRowCellValue(this.gridView未发货.FocusedRowHandle, "mobile").ToString();
                foreach (RetailUserOrderVO item in this.retailUserOrders)
                {
                    if (mobile.Equals(item.mobile))
                    {
                        new Form秒杀发货详情(item.mobile).ShowDialog();
                        break;
                    }
                }
            }
            catch { }
        }

    }
    public class RetailUserOrderVO
    {
        public String customer { get; set; }
        public String id { get; set; }  //  id
        public String mobile { get; set; }  //  电话
        public String customerName { get; set; }
        public Double actualPayment { get; set; } //    实付单价
        public Boolean ifDelivery { get; set; } // 是否发货
        public DateTime orderDate { get; set; } //  下单日期
        public String size { get; set; }    //  尺码
        public int quantity { get; set; } //   数量
        public String skuId { get; set; }    //  skuId

        public String description { get; set; }    //  描述
        public RetailUserOrderVO(RetailUserOrderDTO retailUserOrderDTO)
        {
            this.customer = retailUserOrderDTO.customerName + " " + retailUserOrderDTO.mobile;
            this.id = retailUserOrderDTO.id;
            this.mobile = retailUserOrderDTO.mobile;
            this.customerName = retailUserOrderDTO.customerName;
            this.actualPayment = retailUserOrderDTO.actualPayment;
            this.ifDelivery = retailUserOrderDTO.ifDelivery;
            this.orderDate = retailUserOrderDTO.orderDate;
            this.size = retailUserOrderDTO.size;
            this.quantity = retailUserOrderDTO.quantity;
            this.skuId = retailUserOrderDTO.skuId;
            this.description = retailUserOrderDTO.description;
        }
    }
}